package com.eorchis.module.addUser.service.Impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.eorchis.constants.DeptConstants;
import com.eorchis.core.basedao.dao.IDaoSupport;
import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.core.service.impl.AbstractBaseService;
import com.eorchis.core.ui.commond.ICommond;
import com.eorchis.module.addUser.bean.DepartmentBean;
import com.eorchis.module.addUser.bean.UserBean;
import com.eorchis.module.addUser.dao.IAddUserDao;
import com.eorchis.module.addUser.service.IAddUserService;
import com.eorchis.module.addUser.ui.commond.UserQueryCommond;

@Service(value = "com.eorchis.module.addUser.service.impl.IAddUserServiceImpl")
public class IAddUserServiceImpl extends AbstractBaseService  implements IAddUserService{

	@Autowired
	@Qualifier("com.eorchis.module.addUser.dao.Impl.AddUserImpl")
	private IAddUserDao addUserDao;
	
	@Override
	public boolean addBwAdmin(UserQueryCommond commond) {
		return addUserDao.addBwAdmin(commond);
	}

	@Override
	public boolean EnableBwAdmin(UserQueryCommond commond) {
		return addUserDao.EnableBwAdmin(commond);
	}

	@Override
	public List<UserBean> findBwAdmin(UserQueryCommond commond) {
		if(!commond.getDepId().equals(DeptConstants.BW_DEPT_ROOT_ID)){
			commond.setSearchDepCode(addUserDao.getDeptCode(commond.getDepId()));
		}
		return addUserDao.findBwAdmin(commond);
	}

	@Override
	public boolean resetBwAdmin(UserQueryCommond commond) {
		return addUserDao.resetBwAdmin(commond);
	}

	@Override
	public List<DepartmentBean> getDepartmentsList(UserQueryCommond commond) {
		commond.setSearchDepCode(addUserDao.getDeptCode(commond.getDepId()));
		return addUserDao.getDepartmentsList(commond);
	}

	@Override
	public IDaoSupport getDaoSupport() {
		return addUserDao;
	}

	@Override
	public <C extends ICommond> C toCommond(IBaseEntity ibaseentity) {
		return null;
	}

}
